package com.lineage.server.serverpackets;

import com.lineage.server.world.WorldClan;
import java.util.HashMap;

public class S_PacketBoxWar extends ServerBasePacket {
  public static final int MSG_WAR_BEGIN = 0;
  
  public static final int MSG_WAR_END = 1;
  
  public static final int MSG_WAR_GOING = 2;
  
  public static final int MSG_WAR_INITIATIVE = 3;
  
  public static final int MSG_WAR_OCCUPY = 4;
  
  public static final int MSG_WIN_LASTAVARD = 30;
  
  public static final int MSG_WAR_OVER = 79;
  
  private byte[] _byte;
  
  public S_PacketBoxWar() {
    this._byte = null;
    HashMap<Integer, String> map = WorldClan.get().castleClanMap();
    int count = 7;
    writeC(250);
    writeC(79);
    writeC(7);
    int key = 1;
    while (key < 7) {
      String clanName = map.get(Integer.valueOf(key));
      if (clanName != null) {
        writeS(clanName);
      } else {
        writeS(" ");
      } 
      key++;
    } 
    map.clear();
  }
  
  public S_PacketBoxWar(int subCode) {
    this._byte = null;
    writeC(250);
    writeC(subCode);
  }
  
  public S_PacketBoxWar(int subCode, int value) {
    this._byte = null;
    writeC(250);
    writeC(subCode);
    writeC(value);
    writeH(0);
  }
  
  public S_PacketBoxWar(int subCode, int id, String name, String clanName) {
    this._byte = null;
    writeC(250);
    writeC(30);
    writeD(id);
    writeS(name);
    writeS(clanName);
  }
  
  public byte[] getContent() {
    if (this._byte == null)
      this._byte = getBytes(); 
    return this._byte;
  }
  
  public String getType() {
    return getClass().getSimpleName();
  }
}
